var fid = getUrlMsg()
var baseUrl = "http://47.102.45.219:8080/Appoint/Appoint/FeastSecServlet/selectByAdmin"

$(function () {

	//alert(fid)
	readFeast()
})

function getUrlMsg() {
	var str = location.href;
	var num = str.indexOf("=");
	str = str.substr(num + 1, 1)
	fid = str

	return str;

}

//根据id查询饭局
function selectFeastById(fid) {
	var flist;

	$.ajax({
		url: baseUrl,
		data: {
			"fid": fid
		},
		success: function (data) {
			if (data.statu) {
				flist = data.data
				listall = data.data[0]
				//alert(listall)
			} else {
				alert(data.msg)
			}
		},
		dataType: "json",
		type: 'post',
		statusCode: {
			404: function () {
				alert('page not found');
			}
		},
		xhrFields: {
			withCredentials: true
		},
		async: false
	})
	return listall;
}

function readFeast() {
	var flist = selectFeastById(fid)
	var f_title = eval(flist).f_title
	$("#f_title").val(f_title)
	var uname = eval(flist).users.uname
	$("#uname").val(uname)
	var uemail = eval(flist).users.email
	$("#u_email").val(uemail)
	var pwd = eval(flist).users.pwd
	$("#pwd").val(pwd)
	var f_data = eval(flist).f_data
	$("#f_data").val(f_data)
	var f_start = eval(flist).f_starttime
	$("#f_startTim").val(f_start)
	var f_end = eval(flist).f_endtime
	$("#f_endTime").val(f_end)
	var f_addr = eval(flist).f_address
	$("#f_address").val(f_addr)
}